# -*- coding: utf-8 -*-
"""
Created on Sat May 25 13:01:30 2019

@author: Administrator
"""

# 1016 部分A+B
# 通过率：0.49
"""
def test(self):
    raw_data = str(input()).split(' ')
    number = raw_data[0::2]
    digits = raw_data[1::2]
    
    if len(number) != len(digits):
        return
    
    result = 0
    for i in range(len(number)):
        data = int(number[i])
        if data <=0 or data >= 10 ** 10:
            return
        digit = int(digits[i])
        if digit < 0 or digit > 9:
            return
        
        temp = self.parse_data(data, digit)
        result = result + temp
    
    print(result)

def parse_data(data, digit):
    str_data = str(data)
    count = str_data.count(str(digit))
    if count == 0:
        return 0
    return int(str(digit) * count)
    
#print(parse_data(122234, 0))
#print(parse_data(122234, 10))
#print(parse_data(1222341, 1))

"""
# 1017 A除以B
# 在python3中，int有任意精度，没有固定的最大值，完全取决于可用内存。
"""
def test():
    raw = str(input()).split(' ')
    dividend = int(raw[0])
# 测试用例有bug
#    if dividend <= 0 or dividend > 10 ** 999:
#        return
    
    divisor = int(raw[1])
#    if divisor <= 0 or divisor >= 10:
#        return
    
    remainder = dividend % divisor
    quotient = (dividend-remainder) // divisor
    if dividend == quotient * divisor + remainder:
        print(quotient, remainder)
    
test()
"""

# 1018 剪刀石头布
# 运行超时
"""
def test():
    number = int(input())
    result_list = []
    raw_list = []
    for i in range(number):
        temp = str(input()).split(' ')
        raw_list.append(temp)
        
        result = judge_left(temp)
        result_list.append(result)

    win, tie, lose, tie_set = statistic(result_list)
    
    win_list = list(set(range(number)) - tie_set)
    
    result_a, result_b = max_win(win_list, raw_list)
    
    print(win, tie, lose)
    print(lose, tie, win)
    print(result_a, result_b)
    
    # 打印
    
def judge_left(data):
#    if data 满足'C' > 'J' or 'J' > 'B' or 'B' > 'C'
    if (data[0] == 'C' and data[1] == 'J') or \
        (data[0] == 'J' and data[1] == 'B') or \
        (data[0] == 'B' and data[1] == 'C'):
        return 1
#    elif data 满足 'C' == 'C' or 'J' == 'J' or 'B' == 'B'
    elif data[0] == data[1]:
        return 0
    else:
        return -1

#print(judge_left(['C', 'B']))
def statistic(result_list):
    win = 0
    tie = 0
    lose = 0
    tie_set = set()
    number = len(result_list)
    for j in range(number):
        if result_list[j] == 1:
            win = win + 1
        elif result_list[j] == 0:
            tie = tie + 1
            tie_set.add(j)
        else:
            lose = lose + 1
    
    return win, tie, lose, tie_set

#result_list = [1,0,-1,1,0]
#print(statistic(result_list))
    
def max_win(win_list, raw_list):
    left_max = ''
    right_max = ''
    left_count_dict = {'C':0, 'J':0, 'B':0}
    right_count_dict = {'C':0, 'J':0, 'B':0}
    for win in win_list:
        # 左赢
        if judge_left(raw_list[win]) == 1:
            left_count_dict = dict_count(win, left_count_dict, raw_list, 0)
        # 右赢
        else:
            right_count_dict = dict_count(win, right_count_dict, raw_list, 1)

    left_max_count = max(left_count_dict.values())
    for k in sorted(left_count_dict):
        if left_count_dict[k] == left_max_count:
            left_max = k
            break
    right_max_count = max(right_count_dict.values())
    for k in sorted(right_count_dict):
        if right_count_dict[k] == right_max_count:
            right_max = k
            break
    
    return left_max, right_max
#
#raw_list = [['C', 'J'],['J', 'J'],['B', 'J'],['J', 'C']]
#win_list = [0,2,3]
#print(max_win(win_list, raw_list))

def dict_count(win, count_dict, raw_list, who=0):
    if raw_list[win][who] == 'C':
        count_dict['C'] = count_dict['C'] + 1
    elif raw_list[win][who] == 'J':
        count_dict['J'] = count_dict['J'] + 1
    elif raw_list[win][who] == 'B':
        count_dict['B'] = count_dict['B'] + 1
        
    return count_dict

#result = dict_count(0,{'C':0, 'J':0, 'B':0}, [['C','J'],['B','J']], 0)
#print(result)
test()
"""

# 1019 数字黑洞
"""
def test():
    number = int(input())
    if number <= 0 or number >= 10 ** 4:
        return
    
    number_list_desc, number_list_asc = sort_number(str(number).zfill(4))
    
    number_desc = int(''.join(number_list_desc))
    number_asc = int(''.join(number_list_asc))
    temp = number_desc - number_asc
        
    while temp != 6174:

        number_str_desc = ''.join(number_list_desc)
        number_str_asc = ''.join(number_list_asc)
        if temp == 0:
            print("%s - %s = %s" % \
                  (number_str_desc, number_str_asc, '0000'))
            break
        else:
            print("%s - %s = %s" % (number_str_desc, number_str_asc, str(temp).zfill(4)))
            number_list_desc, number_list_asc = sort_number(str(temp).zfill(4))
            number_desc = int(''.join(number_list_desc))
            number_asc = int(''.join(number_list_asc))
            temp = number_desc - number_asc
    else:
        number_str_desc = ''.join(number_list_desc)
        number_str_asc = ''.join(number_list_asc)
        print("%s - %s = %s" % (number_str_desc, number_str_asc, str(temp).zfill(4)))
            
def sort_number(str_number):
    # 排列字符串数字，返回降序排列和升序排列list

    number_list = list(str_number)
    number_list_desc = sorted(number_list, reverse = True)
    number_list_asc = sorted(number_list)
    return number_list_desc, number_list_asc

test()
"""
# 小结
# 整数补0填充位数
# 方法1：字符串方法zfill(位数)
# "10".zfill(5) # '00010'
# 方法2："%05d" % 87   # '00087'

# 1020 月饼
# 解题思路：
# 根据总售价/库存量来求出每种月饼的单价
# 根据种类单价由高到低来满足需求，直到满足需求或者月饼卖完

# 非零返回
# 坑点：题目没有说库存和售价的类型，因此误认为整型
def test():
    raw = str(input()).split(' ')
    if len(raw) != 2:
        return
    number = int(raw[0])
    if number <= 0 or number > 1000:
        return
    need = int(raw[1])
    if need <= 0 or need > 500:
        return

    # 坑点：改为浮点型即可
    store = [float(ele) for ele in str(input()).split(' ')]
    total_sale = [float(ele) for ele in str(input()).split(' ')]
    if len(store) != number:
        return
    
    prices = []
    
    for i in range(number):
        prices.append(total_sale[i] / store[i])
    
    sorted_prices = sorted(prices, reverse = True)
    # 原价格索引按价格由高到低排序后
    sorted_index = sorted(range(len(prices)), key = lambda k :prices[k], reverse=True)
    
    max_result = 0
    for j in range(number):
        # 获取最高价的库存
        # 不满足need
        if need - store[sorted_index[j]] >=0:
            temp =store[sorted_index[j]] * sorted_prices[j]
            max_result = max_result + temp
            need = need - store[sorted_index[j]]
        # 满足need
        else:
            temp = need * sorted_prices[j]
            max_result = max_result + temp
            break
        
    print("%.2f" % max_result)

test()

# 小结：
# sorted(data)：不改变原数据，返回排序后新数据
# 返回排序列表的索引？
# sorted(range(len(var)), key = vals.__getitem__)
# sorted(range(len(var)), key = lambda k:var[k])
